<%@ page import="com.mlt.back.beans.BasicInfo" %>
<%@ page import="com.mlt.back.service.impl.BasicInfoServiceImpl" %>
<%@ page import="java.util.List" %>
<%@ page import="com.mlt.back.service.impl.InfoDetailServiceImpl" %>
<%@ page import="com.mlt.back.beans.InfoDetail" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%
    List<BasicInfo> basicInfos = new BasicInfoServiceImpl().list();

    // 获取传值
    String infoDetailId = request.getParameter("info_detail_id");

    // 比对获取对应的数据
    List<InfoDetail> infoDetails = new InfoDetailServiceImpl().list();
    InfoDetail infoDetail = null;
    for (InfoDetail temp : infoDetails) {
        if (infoDetailId.equals(String.valueOf(temp.getInfoDetailId()))){
            infoDetail = temp;
            break;
        }
    }
%>

<html>
<head>
    <title>修改选项</title>
</head>
<body>
<div>
    <h2>修改选项</h2>
    <div>
        <form action="/mlt_war_exploded/infoDetail/modify" method="post">
            <input type="text" name="info_detail_id" value="<%=infoDetail.getInfoDetailId()%>" hidden>
            <div>
                <ul>

                    <li><label>所属类目</label>
                        <span>
                            <select name="fk_basic_info_id">
                                <option value="">--选择所属类目--</option>
                                <%for (BasicInfo basicInfo : basicInfos) {%>
                                <option value="<%=basicInfo.getBasic_info_id()%>" <%=infoDetail.getFkBasicInfoId() == basicInfo.getBasic_info_id() ? "selected" : ""%>><%=basicInfo.getBasic_info_name()%></option>
                                <%}%>
                            </select>
                        </span>
                    </li>

                    <li>
                        <label>选项名称</label>
                        <span>
                            <input type="text" name="info_detail_name" value="<%=infoDetail.getInfoDetailName()%>">
						</span>
                    </li>

                    <li>
                        <label>选项描述</label>
                        <span>
                            <input type="text" name="info_detail_desc" value="<%=infoDetail.getInfoDetailDesc()%>">
                        </span>
                    </li>
                </ul>
                <div>
                    <input type="submit">
                </div>
            </div>
        </form>
    </div>
</div>
</body>
</html>
